package org.jeecg.modules.demo.qualityOrder.service.impl;

import org.jeecg.modules.demo.qualityOrder.entity.PuBuyOrderToQualityOrder;
import org.jeecg.modules.demo.qualityOrder.entity.PuQualityOrder;
import org.jeecg.modules.demo.qualityOrder.mapper.PuQualityOrderMapper;
import org.jeecg.modules.demo.qualityOrder.mapper.PuBuyOrderToQualityOrderMapper;
import org.jeecg.modules.demo.qualityOrder.service.IPuBuyOrderToQualityOrderService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.io.Serializable;
import java.util.List;
import java.util.Collection;

/**
 * @Description: 采购订单
 * @Author: jeecg-boot
 * @Date:   2021-11-26
 * @Version: V1.0
 */
@Service
public class PuBuyOrderToQualityOrderServiceImpl extends ServiceImpl<PuBuyOrderToQualityOrderMapper, PuBuyOrderToQualityOrder> implements IPuBuyOrderToQualityOrderService {

	@Autowired
	private PuBuyOrderToQualityOrderMapper puBuyOrderToQualityOrderMapper;
	@Autowired
	private PuQualityOrderMapper puQualityOrderMapper;
	
	@Override
	@Transactional
	public void delMain(String id) {
		puQualityOrderMapper.deleteByMainId(id);
		puBuyOrderToQualityOrderMapper.deleteById(id);
	}

	@Override
	@Transactional
	public void delBatchMain(Collection<? extends Serializable> idList) {
		for(Serializable id:idList) {
			puQualityOrderMapper.deleteByMainId(id.toString());
			puBuyOrderToQualityOrderMapper.deleteById(id);
		}
	}
	@Override
	public PuBuyOrderToQualityOrder getByOrderNumber(String number){
		return puBuyOrderToQualityOrderMapper.getByOrderNumber(number);
	}
	
}
